import config from "@/config"
import http from "@/utils/request"

export default {
	upload: {
		url: `${config.API_URL}/admin/upload`,
		// url: `${config.API_URL}/upload`,
		name: "文件上传",
		post: function (data, config = {}) {
			return new Promise((resolve, reject) => {
				http.post(this.url, data).then((response) => {
					resolve(response)
				}).catch((error) => {
					resolve(error)
				})
			})
		}
	},

	uploadList: {
		url: `${config.API_URL}/admin/uploadList`,
		name: "多个图片上传",
		post: function (data, config = {}) {
			return new Promise((resolve, reject) => {
				http.post(this.url, data).then((response) => {
					resolve(response)
				}).catch((error) => {
					resolve(error)
				})
			})
		}
	},

	uploadFile: {
		url: `${config.API_URL}/admin/upload`,
		name: "附件上传",
		post: function (data, config = {}) {
			return new Promise((resolve, reject) => {
				http.post(this.url, data).then((response) => {
					resolve(response)
				}).catch((error) => {
					resolve(error.data)
				})
			})
		}
	},
	exportFile: {
		url: `${config.API_URL}/fileExport`,
		name: "导出附件",
		get: function (data, config = {}) {
			return new Promise((resolve, reject) => {
				http.get(this.url, data).then((response) => {
					resolve(response)
				}).catch((error) => {
					resolve(error.data)
				})
			})
		}
	},
	importFile: {
		url: `${config.API_URL}/fileImport`,
		name: "导入附件",
		post: function (data, config = {}) {
			return new Promise((resolve, reject) => {
				http.post(this.url, data).then((response) => {
					resolve(response)
				}).catch((error) => {
					resolve(error.data)
				})
			})
		}
	},
	file: {
		menu: {
			url: `${config.API_URL}/file/menu`,
			name: "获取文件分类",
			get: function () {
				return new Promise((resolve, reject) => {
					http.get(this.url).then((response) => {
						resolve(response)
					}).catch((error) => {
						resolve(error.data)
					})
				})
			}
		},
		list: {
			url: `${config.API_URL}/file/list`,
			name: "获取文件列表",
			get: function (data) {
				return new Promise((resolve, reject) => {
					http.get(this.url, data).then((response) => {
						resolve(response)
					}).catch((error) => {
						resolve(error.data)
					})
				})
			}
		}
	},


	// 获取合同等详细内容
	detail: {
		getDetail: {
			url: `${config.API_URL}/examine/list`,
			name: "获取详细内容",
			get: function (param) {
				return new Promise((resolve, reject) => {
					http.get(this.url, param).then((response) => {
						resolve(response)
					}).catch((error) => {
						resolve(error.data)
					})
				})
			}
		},

		getCheckConfigDetail: {
			url: `${config.API_URL}/examine/getList`,
			name: "获取审核流程配置信息",
			get: function (param) {
				return new Promise((resolve, reject) => {
					http.get(this.url, param).then((response) => {
						resolve(response)
					}).catch((error) => {
						resolve(error.data)
					})
				})
			}
		},
		getDictsortDetailOne: {
			url: `${config.API_URL}/dictsortDetail/detailOne`,
			name: "获取审核流程配置信息",
			get: function (param) {
				return new Promise((resolve, reject) => {
					http.get(this.url, param).then((response) => {
						resolve(response)
					}).catch((error) => {
						resolve(error.data)
					})
				})
			}
		},

	},


}
